import mongoengine
from mongoengine import connect,Document,EmbeddedDocument,StringField,IntField,FloatField,ListField,EmbeddedDocumentField

rest = connect('runoob')

SEX_CHOICES = (
    ('male','男'),
    ('female','女'),
)

class Grade(EmbeddedDocument):
    name = StringField(required=True)
    score = FloatField(required=True)
class Student(Document):
    name = StringField(max_length=32,required=True)
    age = IntField(required=True)
    sex = StringField(choices=SEX_CHOICES,required=True)
    address = StringField()
    grade = FloatField()
    grades = ListField(EmbeddedDocumentField(Grade))